using System;
using System.Collections.Generic;
using System.Windows.Forms;

using System.Security;
using System.Security.Principal;

using CSharpDistilled.Diagnostics;
using CSharpDistilled.Diagnostics.Providers;

namespace CSharpDistilled.Diagnostics
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e)
            //                                              {
            //                                                  Exception ex = e.ExceptionObject as Exception;

            //                                                  IIdentity identity = WindowsIdentity.GetCurrent() as IIdentity;

            //                                                  ExceptionProvider.Publish(ex, identity);
            //                                              };

            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //ApplicationContextEx context = new ApplicationContextEx(new DiagnosticsStudio());

                Application.Run(new DiagnosticsStudio());
            }
            catch (Exception ex)
            {
                IIdentity identity = WindowsIdentity.GetCurrent() as IIdentity;

                ExceptionProvider.Publish(ex, identity);
            }
        }
    }
}